const Mock = require('mockjs');
// 获取 mock.Random 对象
const Random = Mock.Random;
// mock一组数据
const produceNewsData = function() {
    let photos = [];
    for (let i = 0; i < 5; i++) {
        let newArticleObject = {

            // userName: Random.cname(), //随机生成一个常见的中文姓名
            // src: '' + Random.dataImage('200x200', 'mock' + i + '的图片'), // Random.dataImage( size, text ) 生成一段随机的 Base64 图片编码
            msrc: 'https://farm6.staticflickr.com/5591/15008867125_68a8ed88cc_m.jpg',
            src: 'http://img3.imgtn.bdimg.com/it/u=4036588911,3720643156&fm=15&gp=0.jpg',
            alt: 'picture1',
            title: 'Image Caption 1',
        }
        photos.push(newArticleObject)
    }

    return {
        photos: photos
    }
}

// Mock.mock( url, post/get , 返回的数据)；
Mock.mock('/news/preview', 'get', produceNewsData);